﻿namespace KingerRobot.MexicoSailunWMS.SpiService;
internal interface ITaskCmd
{
    /// <summary>
    /// 初始化指令
    /// </summary>
    /// <param name="taskCmd">指令信息</param>
    /// <returns></returns>
    int ReSendTaskCmd(List<POWcsTaskCmd> taskCmdList);
    /// <summary>
    /// 手工完成指令
    /// </summary>
    /// <param name="locId">目标库位</param>
    /// <param name="taskId">任务ID</param>
    /// <param name="status">状态</param>
    /// <returns></returns>
    int UpdateTaskCmdStatusForManualEnd(long locId, long taskId, int status);
    /// <summary>
    /// 获取所有指令
    /// </summary>
    /// <returns></returns>
    List<POWcsTaskCmd> GetTaskCmds();
    /// <summary>
    /// 创建任务命令
    /// </summary>
    /// <param name="pOWcsTaskCmd">任务命令模型</param>
    /// <returns>任务命令</returns>
    POWcsTaskCmd CreateTaskCmd(POWcsTaskCmd pOWcsTaskCmd);
    /// <summary>
    /// 设备获取任务
    /// </summary>
    /// <param name="equipId"></param>
    /// <returns></returns>
    POWcsTaskCmd GetTaskCmdByEquipId(long equipId);
    /// <summary>
    /// 通过货叉获取未执行任务
    /// </summary>
    /// <param name="equipId"></param>
    /// <returns></returns>
    POWcsTaskCmd GetExecutableTaskCmdByEquipId(long equipId);
    /// <summary>
    /// 通过货叉获取已执行任务
    /// </summary>
    /// <param name="equipId"></param>
    /// <returns></returns>
    POWcsTaskCmd GetExecutedTaskCmdByEquipId(long equipId);
    /// <summary>
    /// 通过taskId获取任务命令信息
    /// </summary>
    /// <param name="taskId">任务ID</param>
    /// <returns>任务命令信息</returns>
    POWcsTaskCmd GetTaskCmdByTaskId(long taskId);
    /// <summary>
    /// 通过taskNo获取任务命令信息
    /// </summary>
    /// <param name="taskNo"></param>
    /// <returns></returns>
    POWcsTaskCmd GetTaskCmdByTaskNo(int taskNo);
    /// <summary>
    /// 根据组号获取相关指令
    /// </summary>
    /// <param name="groupNo"></param>
    /// <returns></returns>
    List<POWcsTaskCmd> GetTaskCmdsByGroupNo(int groupNo);
    /// <summary>
    /// 开始位置获取任务
    /// </summary>
    /// <param name="locId"></param>
    /// <returns></returns>
    List<POWcsTaskCmd> GetTaskCmdByStartLocId(long locId);
    /// <summary>
    /// 目标位置获取任务
    /// </summary>
    /// <param name="locId"></param>
    /// <returns></returns>
    List<POWcsTaskCmd> GetTaskCmdByTargetLocId(long locId);
    /// <summary>
    /// 是否喷涂
    /// </summary>
    /// <param name="taskNo"></param>
    /// <returns></returns>
    int IsSprayByTaskNo(int taskNo);
    /// <summary>
    /// 通过taskNo获取"可下发"状态任务命令
    /// </summary>
    /// <param name="taskNo"></param>
    /// <returns></returns>
    POWcsTaskCmd GetExecutableTaskCmdByTaskNo(int taskNo);
    /// <summary>
    /// 通过taskNo获取"已下发"状态任务命令
    /// </summary>
    /// <param name="taskNo"></param>
    /// <returns></returns>
    POWcsTaskCmd GetExecutedTaskCmdByTaskNo(int taskNo);
    /// <summary>
    /// 备份并删除任务命令
    /// </summary>
    /// <param name="taskId"></param>
    /// <returns></returns>
    int BakAndDeleteCmd(long taskId);
    /// <summary>
    /// 修改任务命令状态
    /// </summary>
    /// <param name="taskId">任务ID</param>
    /// <param name="status">状态</param>
    int UpdateTaskCmdStatus(long locId, long taskId, int status);
    /// <summary>
    /// 修改任务状态
    /// </summary>
    /// <param name="taskIds"></param>
    /// <param name="status"></param>
    /// <returns></returns>
    int UpdateTaskCmdStatusByTaskIds(List<long> taskIds, int status);
    /// <summary>
    /// 修改任务命令等待状态
    /// </summary>
    /// <param name="equipId">任务ID</param>
    /// <param name="wait">状态</param>
    int UpdateTaskCmdPairWait(long equipId, int wait);
    /// <summary>
    /// 修改指令备注
    /// </summary>
    /// <param name="taskId"></param>
    /// <param name="remark"></param>
    /// <returns></returns>
    int UpdateTaskCmdReamrkByTaskId(long taskId, string remark);
    /// <summary>
    /// 删除任务命令
    /// </summary>
    /// <param name="taskId">任务ID</param>
    /// <returns></returns>
    int DeleteTaskCmdByTaskId(long taskId);

    /// <summary>
    /// 备份任务命令
    /// </summary>
    /// <param name="taskId"></param>
    /// <returns></returns>
    int BakTaskCmdByTaskId(long taskId);

    /// <summary>
    /// 通过产品编号获取是否有任务
    /// </summary>
    /// <param name="productCode"></param>
    /// <returns></returns>
    long GetTaskCmdIdByProductCode(string productCode);

    /// <summary>
    /// 通过开始位置获取下一个进硫化任务
    /// </summary>
    /// <param name="locId">开始位置</param>
    /// <returns></returns>
    POWcsTaskCmd GetNextTaskCmdByLocId(long locId);
    ///// <summary>
    ///// 通过开始位置获取下一个进硫化未执行任务
    ///// </summary>
    ///// <param name="locId"></param>
    ///// <returns></returns>
    //POWcsTaskCmd GetNextExecutableTaskCmdByLocId(long locId);
    /// <summary>
    /// 通过位置获取是否有任务
    /// </summary>
    /// <param name="locId"></param>
    /// <returns></returns>
    long GetExecutableTaskCmdIdkByLocId(long locId);
    /// <summary>
    /// 通过设备查询是否有未完成指令
    /// </summary>
    /// <param name="equipId">设备Id</param>
    /// <returns>是否有任务</returns>
    bool IsTaskCmdByEquipId(long equipId);
    /// <summary>
    /// 根据订单ID获取正在执行的任务指令
    /// </summary>
    /// <param name="masterId">订单ID</param>
    /// <returns></returns>
    List<POWcsTaskCmd> GetTaskCmdsByMasterId(List<long?> masterIds);
    


}